package main

import(
	"github.com/Unknwon/goconfig"
)
var config =make(map[string]string)

func loadconfig(){
	//cfgx:=0
	cfg, errx := goconfig.LoadConfigFile("conf.ini")
	if errx != nil{
			//panic("错误")
			Print_(console_type_error,"[conf.ini] read fail!")
			
	}
	rv:=func(a string,b string,default_ string)string{if(errx!=nil){return default_;};v, err := cfg.GetValue(a, b);if(err!=nil ||v==""){v=default_};return v;}
	//config[]
	/*v, err := cfg.GetValue("vm", "osdir")
	if(err!=nil ||v==""){v="dll/os/"}*/
	config["mysql_ip"]=rv("mysql", "ip","127.0.0.1:3306")
	config["mysql_user"]=rv("mysql", "user","machine")
	config["mysql_pass"]=rv("mysql", "pass","machine")
	config["mysql_base"]=rv("mysql", "base","machine")
	config["server_name"]=rv("server", "name","SmartH")
	config["server_version"]=rv("server", "version","1.0.0.0")
	config["keeptime"]=rv("server", "time","20")
	config["userlength"]=rv("server", "userlength","16")
	config["data_max_len"]=rv("server", "data_max_len","1024")
	config["Buffer"]=rv("server", "Buffer_max_len","1024")
	config["enable_websocket"]=rv("server", "enable_websocket","1")
	config["enable_vm"]=rv("server", "enable_vm","1")
	config["enable_login_Record"]=rv("server", "enable_login_Record","1")
	config["DEBUG"]=rv("main", "debug","true")
	config["bindaddr"]=rv("server", "bindaddr","0.0.0.0:11211")
	vmconfig.osdir=rv("vm", "osdir","dll/os/")
}
//cannot assign *goconfig.ConfigFile to cfgx (type int) in multiple assignment
/*func (*goconfig.ConfigFile)readconfig(){

}*/